package com.example.crmweb.controller;


import com.example.crmweb.entity.Customer;
import com.example.crmweb.lang.Result;
import com.example.crmweb.service.CustomerService;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author -CRM-
 * @since 2022-03-18
 */
@RestController
@RequestMapping("/customer")
public class CustomerController {
    @Resource
    CustomerService customerService;
    //添加客户信息
    @PostMapping("/insert")
    public Result insert(Customer customer,@RequestParam(value = "staffName") String staffName){
        return customerService.insert(customer, staffName);
    }
    //修改客户信息
    @PutMapping("/update/{id}")
    public Result update(@PathVariable("id") Integer customer_id, Customer customer){
        return customerService.update(customer_id, customer);
    }
    //查询所有
    @PostMapping("/selectList")
    public Result SelectList(){
        return customerService.SelectList();
    }
    //根据id进行客户查询
    @PostMapping("/selectId/{id}")
    public Result SelectById(@PathVariable("id") Integer id){
       return customerService.SelectId(id);
    }







}
